-
Notifications
You must be signed in to change notification settings - Fork 619
[SDK] Chain headless components #5495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: d1845f3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Your org has enabled the Graphite merge queue for merging into mainAdd the label “merge-queue” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix. You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link. |
64d6599 to
3a120f7
Compare
3a120f7 to
1417310
Compare
size-limit report 📦
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5495 +/- ##
==========================================
+ Coverage 43.81% 43.84% +0.02%
==========================================
Files 1075 1081 +6
Lines 55991 56186 +195
Branches 3908 3929 +21
==========================================
+ Hits 24534 24635 +101
- Misses 30774 30868 +94
Partials 683 683
*This pull request uses carry forward flags. Click here to find out more.
|
1417310 to
c96fca8
Compare
c96fca8 to
da9bdb1
Compare
| export interface ChainIconProps | ||
| extends Omit<React.ImgHTMLAttributes<HTMLImageElement>, "src"> { | ||
| /** | ||
| * While marked as "optional", you should pass a ThirdwebClient to this prop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why make this optional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to make it mandatory
| if (!cid) { | ||
| throw new Error(`Failed to resolve IPFS CID from ${possibleUrl}`); | ||
| } | ||
| return `https://ipfs.io/ipfs/${cid}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would not hardcode this. Keep it consistent with the rest of the SDK. If you want ipfs, you need a client
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
| ...restProps | ||
| }: ChainNameProps) { | ||
| const { chain } = useChainContext(); | ||
| const nameQuery = useQuery({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come we're not using our existing chain hooks here? Otherwise it's not sharing the cache with the rest of the sdk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got a couple of reasons:
- getChainMetadata is already catched (using withCache)
- I need to add extra logic to the queryFn, using useChainMetadata wouldn't give me what I want (and users won't be able to customize it)
da9bdb1 to
523ffea
Compare
Merge activity
|
## Problem solved
Short description of the bug fixed or feature added
<!-- start pr-codex -->
---
## PR-Codex overview
This PR introduces headless components related to blockchain chain management in the `thirdweb` library, including `ChainProvider`, `ChainIcon`, and `ChainName`. It also adds tests for these components and updates documentation to reflect their usage.
### Detailed summary
- Added headless components: `ChainProvider`, `ChainIcon`, `ChainName`.
- Introduced `TokenIconProps` interface.
- Updated `react.ts` to export new components and their props.
- Added documentation for `ChainProvider`, `ChainIcon`, and `ChainName` in `page.mdx`.
- Implemented tests for `TokenSymbol`, `ChainProvider`, `TokenProvider`, `ChainName`.
- Enhanced `ChainProvider` and `ChainIcon` components with new props and functionalities.
- Updated `ChainName` component to support custom name resolvers and formatting functions.
> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`
<!-- end pr-codex -->
523ffea to
d1845f3
Compare

Problem solved
Short description of the bug fixed or feature added
PR-Codex overview
This PR introduces new headless components in the
thirdwebpackage, specificallyChainProvider,ChainIcon, andChainName, along with their respective props and functionalities. It also includes tests for these components to ensure proper rendering and data handling.Detailed summary
ChainProvider,ChainIcon, andChainNamecomponents.TokenIcon,ChainProvider,ChainIcon, andChainName.TokenSymbol,ChainProvider,TokenProvider,ChainName, andChainIconcomponents.apps/portal/src/app/react/v5/components/onchain/page.mdx.